package com.dup.jxlh.admin.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dup.jxlh.admin.entities.model.Company;
import com.dup.jxlh.admin.entities.vo.CompanyVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.One;

import java.util.ArrayList;

@Mapper
public interface CompanyMapper extends BaseMapper<Company> {
    @Select("select * from company ${ew.customSqlSegment}")
    @Results({
            @Result(column = "admin_id", property = "adminId"),
            @Result(column = "admin_id", property = "adminVO",
                    one = @One(select = "com.dup.jxlh.admin.mapper.AdminMapper.getAdminInfo"))
    })
    ArrayList<CompanyVO> getSonCompanyList(Page page, @Param(Constants.WRAPPER) Wrapper<Company> wrapper);

}
